<%@page import="com.meiya.common.simpledao.BaseDao"%>
<%@page
	import="com.zhangwoo.spider.client.process.SpiderThreadValidation"%>
<%@page import="com.meiya.common.string.StringUtil"%>
<%@page
	import="com.zhangwoo.spider.server.*,java.util.*,com.zhangwoo.spider.po.*"%>
<%@ page contentType="text/html;charset=utf-8"%>
<html>
<head>
<title></title>
</head>
<body>
<%
	String bid = request.getParameter("bid");
	String eid = request.getParameter("eid");
	List<Object[]> rs=new ArrayList<Object[]>();
	String sql="select id,title,content from `www.soqi.cn` ";
	if(StringUtil.isCorrectNumber(bid)&&StringUtil.isCorrectNumber(eid)){
		if((Integer.valueOf(eid)-Integer.valueOf(bid))>0){
			//sql=sql+" order by id limit "+bid+","+(Integer.valueOf(eid)-Integer.valueOf(bid));
			sql=sql+" where id between "+bid+" and "+eid+" ";
		}
	}
	rs=new BaseDao().query(sql);
	
%>
<form action="exportsoqi.jsp" method="post">
<table border=1 width="100%">
	<tr>
		<td>表名:www.soqi.cn, ID区间<input name="bid" value="<%=bid%>">
		TO <input name="eid" value="<%=eid%>"></td>
	</tr>
	<tr>
		<td><input type="submit"></td>
	</tr>
	<tr>
		<td>
		<table border=1 width="100%">
		<tr><td>id</td><td>名称</td><td>联系人</td><td>电话</td><td>手机</td></tr>
		<%
		for(Object[] os : rs){
			String cp="";
			if(os[2].toString().indexOf("联系人:")>-1){
				if(os[2].toString().indexOf("电话:")>-1){
					cp=os[2].toString().substring(os[2].toString().indexOf("联系人:")+4,os[2].toString().indexOf("电话:"));
				}else{
					cp=os[2].toString().substring(os[2].toString().indexOf("联系人:")+4,os[2].toString().indexOf("联系人:")+7);					
				}
			}
			
			String tel="";
			try{
			tel=StringUtil.match(os[2].toString(),"电话: ([\\d|\\-]+)")[1];
			}catch(Exception e){}
			String mob="";
			try{
				mob=StringUtil.match(os[2].toString(),"手机: ([\\d|\\-]+)")[1];
				}catch(Exception e){}
			out.print("<tr><td>"+os[0]+"</td><td>"+os[1]+"</td><td>"+cp+"</td><td>"+tel+"</td><td>"+mob+"</td></tr>");
		}
		%>
		</table>
		</td>
	</tr>
</table>
</form>
</body>
</html>